﻿
namespace BulletOnRails4NET.Controllers
{

    public class PathResolver 
    {
        /// <summary>
        /// Gets the root of the site we're working with
        /// </summary>
        /// <returns></returns>
        public static string GetSiteRoot()
        {

            string appPath = System.Web.HttpContext.Current.Request.ApplicationPath;
            if (appPath == string.Empty)
                appPath = "/";

            return appPath;
        }
        /// <summary>
        /// Gets an icon image
        /// </summary>
        /// <param name="controlName">The name of the icon</param>
        /// <returns></returns>
        public static string GetImageIcon(string icon_name)
        {
            string appPath = GetSiteRoot();

            //all icon images are kept in ~/images/grammar_icons/
            string result = appPath + "images/grammar_icons/" + icon_name;
            return result;
        }

    }
}